import { createApp } from "vue";
import App from "@/App.vue";
// 引入elementplus和样式文件
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
// 引入对element-plus的国际化配置
// @ts-ignore
import zhCn from "element-plus/dist/locale/zh-cn.mjs";
import "virtual:svg-icons-register";
import globalComponents from "./components/index";
// 引入样式文件
import "./styles/index.scss";
import router from "./router/index";
import pinia from "./store/index";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
// 暗黑模式的样式
import "element-plus/theme-chalk/dark/css-vars.css";
// 引入路由守卫文件
import "./permission";
import { isHaveButton } from "./directive/have";
import { vLazyLoad } from "@/directive/lazyLoad";
const app = createApp(App);
app.use(ElementPlus, {
  locale: zhCn,
});
// 将element-plus中的所有图标并进行全局注册
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
// 自定义指令
isHaveButton(app);
vLazyLoad(app);
app.use(globalComponents);
app.use(router);
app.use(pinia);
app.mount("#app");
